<!-- 预约详情模态框内容 -->
<div class="modal-header">
    <h5 class="modal-title">
        <i class="fas fa-calendar-check me-2"></i>预约详情
        <small class="text-muted ms-2">#{{ reservation_data.reservation.id }}</small>
    </h5>
    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>

<div class="modal-body">
    <!-- 状态显示 -->
    <div class="mb-3">
        {% if reservation_data.reservation.status == 'pending' %}
            <span class="badge bg-warning fs-6">
                <i class="fas fa-clock me-1"></i>待确认
            </span>
        {% elif reservation_data.reservation.status == 'confirmed' %}
            <span class="badge bg-success fs-6">
                <i class="fas fa-check-circle me-1"></i>已确认
            </span>
        {% elif reservation_data.reservation.status == 'completed' %}
            <span class="badge bg-primary fs-6">
                <i class="fas fa-check-double me-1"></i>已完成
            </span>
        {% elif reservation_data.reservation.status == 'cancelled' %}
            <span class="badge bg-danger fs-6">
                <i class="fas fa-times-circle me-1"></i>已取消
            </span>
        {% elif reservation_data.reservation.status == 'no_show' %}
            <span class="badge bg-secondary fs-6">
                <i class="fas fa-user-times me-1"></i>未出席
            </span>
        {% endif %}
    </div>

    <!-- 学员信息 -->
    <div class="row mb-3">
        <div class="col-sm-3"><strong>学员：</strong></div>
        <div class="col-sm-9">
            <div class="d-flex align-items-center">
                <div class="me-2">
                    {% if reservation_data.reservation.student.photo_url %}
                        <img src="{{ reservation_data.reservation.student.photo_url }}" alt="学员头像"
                             class="rounded-circle" width="40" height="40">
                    {% else %}
                        <div class="bg-primary text-white rounded-circle d-flex align-items-center justify-content-center"
                             style="width: 40px; height: 40px;">
                            {{ reservation_data.reservation.student.real_name[0] }}
                        </div>
                    {% endif %}
                </div>
                <div>
                    <div class="fw-bold">{{ reservation_data.reservation.student.real_name }}</div>
                    <small class="text-muted">{{ reservation_data.reservation.student.phone }}</small>
                </div>
            </div>
        </div>
    </div>

    <!-- 预约时间 -->
    <div class="row mb-3">
        <div class="col-sm-3"><strong>日期：</strong></div>
        <div class="col-sm-9">{{ reservation_data.reservation.reservation_date.strftime('%Y年%m月%d日') }}</div>
    </div>

    <div class="row mb-3">
        <div class="col-sm-3"><strong>时间：</strong></div>
        <div class="col-sm-9">
            {{ reservation_data.reservation.start_time.strftime('%H:%M') }} -
            {{ reservation_data.reservation.end_time.strftime('%H:%M') }}
            <small class="text-muted">({{ reservation_data.reservation.duration_minutes }}分钟)</small>
        </div>
    </div>

    <!-- 场地信息 -->
    <div class="row mb-3">
        <div class="col-sm-3"><strong>球台：</strong></div>
        <div class="col-sm-9">{{ reservation_data.reservation.table.name }}</div>
    </div>

    <div class="row mb-3">
        <div class="col-sm-3"><strong>校区：</strong></div>
        <div class="col-sm-9">{{ reservation_data.reservation.campus.name }}</div>
    </div>

    <!-- 费用信息 -->
    <div class="row mb-3">
        <div class="col-sm-3"><strong>费用：</strong></div>
        <div class="col-sm-9">
            <span class="h5 text-success mb-0">¥{{ "%.2f"|format(reservation_data.reservation.price) }}</span>
        </div>
    </div>

    <!-- 取消原因（如果有） -->
    {% if reservation_data.reservation.status == 'cancelled' and reservation_data.reservation.cancel_reason %}
    <div class="row mb-3">
        <div class="col-sm-3"><strong>取消原因：</strong></div>
        <div class="col-sm-9">
            <div class="alert alert-warning mb-0">
                <i class="fas fa-exclamation-triangle me-1"></i>
                {{ reservation_data.reservation.cancel_reason }}
            </div>
        </div>
    </div>
    {% endif %}

    <!-- 创建时间 -->
    <div class="row mb-3">
        <div class="col-sm-3"><strong>预约时间：</strong></div>
        <div class="col-sm-9">
            <small class="text-muted">{{ reservation_data.reservation.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</small>
        </div>
    </div>
</div>

<div class="modal-footer">
    <!-- 操作按钮 -->
    {% if reservation_data.can_confirm %}
        <button type="button" class="btn btn-success" onclick="confirmReservation({{ reservation_data.reservation.id }})">
            <i class="fas fa-check me-1"></i>确认预约
        </button>
    {% endif %}

    {% if reservation_data.can_reject %}
        <button type="button" class="btn btn-warning" onclick="rejectReservation({{ reservation_data.reservation.id }})">
            <i class="fas fa-times me-1"></i>拒绝预约
        </button>
    {% endif %}

    {% if reservation_data.can_complete %}
        <button type="button" class="btn btn-primary" onclick="completeReservation({{ reservation_data.reservation.id }})">
            <i class="fas fa-check-double me-1"></i>完成课程
        </button>
    {% endif %}

    {% if reservation_data.can_mark_no_show %}
        <button type="button" class="btn btn-secondary" onclick="markNoShow({{ reservation_data.reservation.id }})">
            <i class="fas fa-user-times me-1"></i>标记未出席
        </button>
    {% endif %}

    {% if reservation_data.can_cancel %}
        <button type="button" class="btn btn-danger" onclick="cancelReservation({{ reservation_data.reservation.id }})">
            <i class="fas fa-ban me-1"></i>取消预约
        </button>
    {% endif %}

    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
        <i class="fas fa-times me-1"></i>关闭
    </button>
</div>